include(['init'], function(){
	declare('menus.ExitMenu');

	var layerMove = function(e){
		var MAX = 1000;
		var sX = e.bId.lastX || e.bId.x;
		var sY = e.bId.lastY || e.bId.y;
		
		var moveX = e.x-sX;
		moveX = Math.abs(moveX) > MAX ? MAX*(moveX/Math.abs(moveX)) : moveX;
		var moveY = e.y-sY;
		moveY = Math.abs(moveY) > MAX ? MAX*(moveY/Math.abs(moveY)) : moveY;
		
		e.bId.lastX = e.x;
		e.bId.lastY = e.y;
		
		eGrid.translate(moveX, moveY);
	};

    var highlightCell = function(e){
        eGrid.hit(e)
    };

	inputManager.addListener("exitMenu", {
        highlightActive : false,
        onMenu : function(e){
            if(e.bId == 'exitButton'){
                if( e.buttons ){
                    this.highlightActive = false;
                    inputManager.lock(null);
                    eGrid.renderGrids = false;
                }else{
                    this.highlightActive = true;
                    inputManager.lock('exitMenu');
                    eGrid.renderGrids = true;
                }
            }
        },
        onButtonDown : function(e){
            var cell = room.getTile(e.x, e.y);
            if( cell ){

            }
        },
        onMove : function(e){
            if( this.highlightActive ){
                highlightCell(e);
            }
        }
	});

});